import React from 'react';
import CartHeader from '../../components/cart/cartHeader/CartHeader';
import CartProduct from '../../components/cart/cartProduct/CartProduct';
import { connect } from 'react-redux';
import { Empty } from 'antd-mobile'
// import ProductTotal from '../../components/cart/productTotal/ProductTotal';
import './cart.css'
const Cart = (props)=>{

    const {productList = []} = props
    // console.log('cart props',productList);

    const productLen = productList.length
    return(
        <div className='cart-container'>
            <CartHeader productLen = {productLen}></CartHeader>
            {
                productLen==0? <Empty description='暂无数据,去主页逛逛吧！'  style={{ marginTop: '50px' }}></Empty>: <CartProduct productList = {productList}></CartProduct>
            }
           {/* <ProductTotal></ProductTotal> */}
        </div>
    )
}

const mapStateToProps = (state)=>{
    return{
        productList:state.cart.productList
    }
}

const mapStateToDispatch = (dispatch)=>{
    return{

    }
}

export default connect(mapStateToProps,null)(Cart)